#include <stdio.h>

void mem_print_hex(void *start, int length)
{
    char *p = NULL;
    char value;
    int i, j, bit, power, hex_value;
    int mask = 1 << 7;
    
    printf("\n");
    p = (char*)start;
    for (i=0; i<length; i++) {
        if (i % 8 == 0) {
            printf("\n");
        }
        value = *(p+i);
        power = 1 << 7;
        hex_value = 0;
        for (j=0; j<8; j++) {
            bit = ((value & mask) == 0) ? 0 : 1;
            hex_value += bit * power;
            value <<= 1; 
            power >>= 1;
        }
        printf("%02x ", hex_value);
    }
    printf("\n");
}

int a = 1;
int b;
static c;

int main()
{
    int x = 2;
    int y = 3;
    char z ='z';

    static char w = 'w';

    int *p = (int*)malloc(sizeof(int));
    char *p2 = "str";

    printf("&a=0x%08x\n", &a);
    printf("&b=0x%08x\n", &b);
    printf("&c=0x%08x\n", &c);
    printf("&x=0x%08x\n", &x);
    printf("&y=0x%08x\n", &y);
    printf("&z=0x%08x\n", &z);
    printf("&w=0x%08x\n", &w);
    printf("&p=0x%08x\n", &p);
    printf("p=0x%08x\n", p);
    printf("p2=0x%08x\n", p2);

    return 0;
}

/* vim : foldmethod=indent */

